import * as actionTypes from "./actionTypes";
import axios from 'axios';
 
import "../../../api/mock.js";
 
 
export const changelogin = (data) => ({
    type: actionTypes.changelogin,
    data:data,
})

export const login = (form) => {
    return (dispatch)=>{
        axios.post("/login.json",form).then(res=>{
            const result =res.data.code
           
             if (result=="200") {
                 dispatch(changelogin(true))
             }else{
                 alert("登录失败")
             }
            
        })
    }
}
